#include <iostream>
#include <string>

#include "linked_list.h"

using namespace std;

int main()
{
	LinkedList<int> list;
   
   for (int i = 0; i < 10; i++)
      list.insert(0);

	cout << list << endl;

	for (LinkedListIterator<int> iter = list.begin(); iter != list.end(); ++iter)
		cout << iter << ": " << *iter << endl;

	int a[] = {10, 20, 30, 40, 50};

	list.clear();
   for (int i = 0; i < 5; i++)
      list.insert(a[i]);

	cout << list << endl;

	for (LinkedListIterator<int> iter = list.begin(); iter != list.end(); ++iter)
		cout << iter << ": " << *iter << endl;

	LinkedListIterator<int> iter2 = list.end();
	try {
		cout << *iter2;
	} catch (LinkedListIteratorException e) {
		cout << e << endl;
	}

	try {
		cout << ++iter2;
	} catch (LinkedListIteratorException e) {
		cout << e << endl;
	}

	LinkedList<string> list2;
   for (int i = 0; i < 3; i++)
      list.insert(0);

	cout << list2 << endl;

	for (LinkedListIterator<string> iter = list2.begin(); iter != list2.end(); ++iter)
		cout << iter << ": " << *iter << endl;

	string a2[] = {"A", "B", "C", "D"};

	list2.clear();
   for (int i = 0; i < 4; i++)
      list2.insert(a2[i]);

	cout << list2 << endl;

	for (LinkedListIterator<string> iter = list2.begin(); iter != list2.end(); ++iter)
		cout << iter << ": " << *iter << endl;

	LinkedListIterator<string> iter3 = list2.end();
	try {
		cout << *iter3;
	} catch (LinkedListIteratorException e) {
		cout << e << endl;
	}

	try {
		cout << ++iter3;
	} catch (LinkedListIteratorException e) {
		cout << e << endl;
	}

	return 0;
}

